package com.apps.sdses.flink141.source;

import org.apache.flink.api.java.tuple.Tuple4;
import org.apache.flink.streaming.api.functions.source.SourceFunction;

/**
 * author: codejiwei
 * date: 2023/8/11
 * desc: test
 **/
public class UserDefinedSource implements SourceFunction<Tuple4<String, String, Integer, Long>> {
    private volatile boolean isCancel;
    @Override
    public void run(SourceContext<Tuple4<String, String, Integer, Long>> sourceContext) throws Exception {
        while (!isCancel) {

            sourceContext.collect(Tuple4.of("a", "b", 1, System.currentTimeMillis()));

            Thread.sleep(10L);
        }
    }

    @Override
    public void cancel() {
        isCancel = true;
    }
}
